package day04;

import java.util.Scanner;

public class day04SdEx {
    public static void main(String[] args) {
        //1。
        /* Scanner scanner = new Scanner(System.in);
        System.out.println("请输入成绩：");
        int score = scanner.nextInt();
        if (score < 0 || score > 100){
            System.out.println("成绩不合法");
        }else if (score >= 90){
            System.out.println("A-优秀");
        }else if (score >= 80){
            System.out.println("B-良好");
        }else if (score >= 60){
            System.out.println("C-中等");
        }else{
            System.out.println("D-不及格");
        }*/

        /*//2.
        Scanner scanner = new Scanner(System.in);
        System.out.println("请选择操作：1.取款 2.存款 3.查询余额 0.退卡");
        int command = scanner.nextInt();
        switch (command){
            case 1:System.out.println("取款");
                 break;
            case 2:System.out.println("存款");
                 break;
            case 3:System.out.println("查询余额");
                 break;
            case 0:System.out.println("退卡操作");
                 break;
            default:System.out.println("输入错误");
        }
*/

        //3.
        /*Scanner scanner = new Scanner(System.in);
        int num = (int)(Math.random() * 1000 + 1);
        System.out.println(num);
        System.out.println("猜吧");
        int guess = scanner.nextInt();
        while(guess != num){
            if (guess > num){
                System.out.println("猜的数过大了");
            }else{
                System.out.println("猜的数过小了");
            }
            System.out.println("猜吧");
            guess = scanner.nextInt();
        }
        System.out.println("恭喜你猜对了");
*/

        //4
        Scanner scanner = new Scanner(System.in);
        int num = (int) (Math.random() * 1000 + 1);
        System.out.println(num);

        int guess;
        do {
            System.out.println("猜吧");
            guess = scanner.nextInt();
            if (guess > num) {
                System.out.println("猜的数过大了");
            } else if (guess < num) {
                System.out.println("猜的数过小了");
            } else {
                System.out.println("恭喜你猜对了");
            }
        } while (guess != num);
    }
}
